import Mock from 'mockjs';
import { API_CODE } from '@/api/constant';

// 获取菜单列表
Mock.mock(/\/api\/menu\/list/, 'get', () => {
  return {
    code: API_CODE.SUCCESS,
    message: '获取菜单列表成功',
    data: [
      {
        id: '1',
        name: '工作台',
        path: '/dashboard',
        icon: 'HomeFilled',
        funcodeId: 'dashboard'
      },
      {
        id: '2',
        name: '应用管理',
        path: '/app',
        icon: 'Grid',
        funcodeId: 'app',
        children: [
          {
            id: '2-1',
            name: '应用列表',
            path: '/app/list',
            funcodeId: 'app:list'
          },
          {
            id: '2-2',
            name: '创建应用',
            path: '/app/create',
            funcodeId: 'app:create'
          },
          {
            id: '2-3',
            name: '应用详情',
            path: '/app/detail/:id',
            funcodeId: 'app:detail',
            isHidden: true
          }
        ]
      },

      {
        id: '4',
        name: '关于',
        path: '/about',
        icon: 'InfoFilled',
        funcodeId: 'about'
      },
      {
        id: '5',
        name: '联系我们',
        path: '/contact',
        icon: 'Phone',
        funcodeId: 'contact'
      }
    ]
  };
});

// 获取用户权限菜单
Mock.mock(/\/api\/menu\/user\/\w+/, 'get', () => {
  return {
    code: API_CODE.SUCCESS,
    message: '获取用户权限菜单成功',
    data: [
      'dashboard',
      'app',
      'app:list',
      'app:create',
      'app:detail',
      'order',
      'order:list',
      'order:create',
      'order:detail',
      'about',
      'contact'
    ]
  };
});
